package com.example.test.sendMessage;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

import javax.xml.namespace.QName;
import java.security.MessageDigest;


public class SendMessage {

    public static void main(String[] args) throws AxisFault {
        //远程调用地址
        String url="http://msg.51tgt.com:8060/tgtweb/services/sentMsgByPlatFormService?wsdl";

        //API
        String apiName="sendNote";

        RPCServiceClient rpcServiceClient=new RPCServiceClient();
        Options options=rpcServiceClient.getOptions();
        // 创建远程地址
        EndpointReference endpointReference=new EndpointReference(url);
        options.setTo(endpointReference);

        QName qName=new QName("http://webservice.tgt.com",apiName);

        String key=KeyUtils.createKey("BSS");
        String key1=KeyUtils.createKey("aaa");
        String k="459b91edc50a8068da95c15bb9383d05";
        System.out.println(key+" --- "+key1);
       // 创建发送内容对象
        String s="{\"content\":\"k接口测试。\",\"phoneNum\":\"13122100085\",\"implName\":\"BSS\",\"key\":\""+key+"\"}";
        Object []objects=new Object[]{ s.toString() };
        Class [] classes =new Class[]{String.class};
        String response=rpcServiceClient.invokeBlocking(qName,objects,classes)[0]+"";
        System.out.println("响应结果:"+response);

    }
}
